DROP TABLE IF EXISTS `tb_saas_client`;
CREATE TABLE `tb_saas_client`
(
    `id`                     varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT 'ID',
    `name`                   varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL DEFAULT '' COMMENT '应用名称',
    `home_uri`               varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '手机号码',
    `client_secret`          varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户邮箱',
    `redirect_uri`           varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '登录密码',
    `auto_approve`           tinyint                                                                DEFAULT '0' COMMENT '自动授权，1自动|0',
    `create_date`            datetime                                                      NOT NULL COMMENT '注册时间',
    `scope`                  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'all' COMMENT '授权范围',
    `resource_ids`           varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '资源ID',
    `authorities`            varchar(255) COLLATE utf8mb4_general_ci                       NOT NULL DEFAULT '',
    `refresh_token_validity` int                                                           NOT NULL DEFAULT '2592000' COMMENT '刷新token有效时长，单位：s',
    `access_token_validity`  int                                                           NOT NULL DEFAULT '7200' COMMENT 'token有效时长，单位：s',
    `authorized_grant_types` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户端被授权的授权类型,包括password,authorization_code,refresh_token',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='saas第三方应用client信息表';

-- ----------------------------
-- Records of tb_saas_client
-- ----------------------------
BEGIN;
INSERT INTO `tb_saas_client`
VALUES ('1366615609466900480', 'Device Studio', 'http://www.hzwtech.com', '6086d06ab36846c396a9e9b3fbb4c323', 'http://cloud.hzwtech.com', 1, '2021-03-02 13:05:26', 'all', 'saas-service', '', 2592000, 43200,
        'password,authorization_code,refresh_token');
INSERT INTO `saasr2`.`tb_saas_client`(`id`, `name`, `home_uri`, `client_secret`, `redirect_uri`, `auto_approve`, `create_date`, `scope`, `resource_ids`, `authorities`, `refresh_token_validity`, `access_token_validity`,
                                      `authorized_grant_types`)
VALUES ('1366615609466900481', '鸿之微云', 'https://iresearch.net.cn', '6086d06ab36846c396a9e9b3fbb4c324',
        'https://iresearch.net.cn/saas/login,https://dev.hzwtech.com/saas/login,https://test.hzwtech.com/saas/login,https://sim.hzwtech.com/saas/login,http://localhost:8080/saas/login,http://localhost:8081/saas/login,http://localhost:8082/saas/login',
        1, '2021-03-02 13:05:26', 'all', 'saas-service,saas-user-center', '', 2592000, 43200, 'password,authorization_code,refresh_token');

INSERT INTO `saasr2`.`tb_sys_dict`(`pid`, `module`, `key`, `value`, `status`, `description`, `creator_id`, `editor_id`, `create_time`, `update_time`, `is_delete`)
VALUES ('100101', 'SSO', 'getTokenApi', 'https://iresearch.net.cn/sso-api/saas/oauth2/access', 1, '用户中心通过code获取token接口', '', '', '2021-11-19 16:41:12', '2021-11-19 16:41:12', 0);
INSERT INTO `saasr2`.`tb_sys_dict`(`pid`, `module`, `key`, `value`, `status`, `description`, `creator_id`, `editor_id`, `create_time`, `update_time`, `is_delete`)
VALUES ('100102', 'SSO', 'clientId', '1366615609466900481', 1, '鸿之微云客户端id', '', '', '2021-11-19 16:44:34', '2021-11-19 16:44:34', 0);
INSERT INTO `saasr2`.`tb_sys_dict`(`pid`, `module`, `key`, `value`, `status`, `description`, `creator_id`, `editor_id`, `create_time`, `update_time`, `is_delete`)
VALUES ('100103', 'SSO', 'secret', '6086d06ab36846c396a9e9b3fbb4c324', 1, '鸿之微云客户端密钥', '', '', '2021-11-19 16:44:34', '2021-11-19 16:44:34', 0);

COMMIT;
